package com.dxysun.design.observer.universe;

public class Main
{
	public static void main(String[] args)
	{
		ConcreteObserver<String> concreteObserver1 = new ConcreteObserver<>("观察者1");
		ConcreteObserver<String> concreteObserver2 = new ConcreteObserver<>("观察者2");

		ConcreteSubject<String> concreteSubject = new ConcreteSubject<>();
		concreteSubject.attach(concreteObserver1);
		concreteSubject.attach(concreteObserver2);
		concreteSubject.notify("subject");

		concreteSubject.detach(concreteObserver1);
		concreteSubject.notify("new subject");
	}
}
